#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

#define SIZE 512
int main()
{
    //1、C语言IO接口
    // FILE *fp = fopen("bite", "w");
    // char message[] = "Linus so easy!!!";
    // fwrite(message, sizeof(message[0]), sizeof(message) / sizeof(message[0]), fp);
    // fclose(fp);
    // FILE *fp = fopen("bite", "r");
    // char message[SIZE];
    // fread(message, sizeof(char), SIZE, fp);
    // printf(message);
    // fclose(fp);

    //2、Linux IO接口
    int id = open("bite", O_WRONLY|O_CREAT);
    char message[] = "Linus so easy!!!\n";
    write(id, message, strlen(message));
    close(id);
    id = open("bite", O_RDONLY);
    char tmp[SIZE];
    read(id, tmp, SIZE);
    printf(tmp);
    close(id);
    return 0;
}